package com.example.seckill.controller;


import com.example.seckill.service.IUserService;
import com.example.seckill.vo.LoginVo;
import com.example.seckill.vo.RespBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能描述：跳转登录页面
 */
@Controller
@RequestMapping( "/login")
@Slf4j
public class LoginContronller {

    @Autowired
    private IUserService IUserService;

    @RequestMapping( "/toLogin")
    public String toLogin() {
        return "login";
    }

    /**
     * 功能描述：登录
     * @param loginVo
     * @return
     */
    @PostMapping("/doLogin")
    @ResponseBody
    public RespBean doLogin(LoginVo loginVo){
        //log.info("{}", loginVo);
        return IUserService.doLogin(loginVo);

    }
}
